package com.xxl.job.admin.core.route;

import java.util.ArrayList;

/**
 * Created by xuxueli on 17/3/10.
 */
public abstract class ExecutorRouter {

    public abstract String route(Long jobId, ArrayList<String> addressList);

    public static String route(Long jobId, ArrayList<String> addressList, String executorRouteStrategy){
		if (addressList == null || addressList.isEmpty()) {
            return null;
        }
        ExecutorRouteStrategyEnum strategy = ExecutorRouteStrategyEnum.match(executorRouteStrategy, ExecutorRouteStrategyEnum.FIRST);
        String routeAddress = strategy.getRouter().route(jobId, addressList);
        return routeAddress;
    }

}
